function onLoginClick(e) {
	
	var form = new mini.Form("#loginForm");
	form.validate();
	if (form.isValid() == false) {
		return;
	}
	
	var username = mini.get("username").getValue();
	var password = mini.get("pwd").getValue();
	var security = mini.get("security").getValue();
	var params="parms.username="+username+"&parms.password="+password+"&parms.security="+security;
	//alert(params);
	//提交数据(这个json不好用)
//    var data = form.getData(); 
//    var params = mini.encode(data);
	$.ajax({
		type : 'post',
		url : 'adminLogin.cms',
		data : params, // 传给action的参数
		async:false,
		success : function(data) { 
			if(data.msg=="true"){
 				loginWindow.hide();
 				mini.loading("登录成功，马上转到系统...", "登录成功");
				setTimeout(function() {
					window.location = "pages/home/index.html";
				}, 1500);
			}else{
				mini.alert(data.msg,"提示",onResetClick);
			}
		},
		error: function(XMLHttpRequest, textStatus, errorThrown) {
			 alert(XMLHttpRequest.status);
			 alert(XMLHttpRequest.responseText);
//			 alert(textStatus);
		}
	});

}


function onResetClick(e) {
	var form = new mini.Form("#loginWindow");
	form.clear();
}

function isEmail(s) {
	if (s.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		return true;
	else
		return false;
}
function onUserNameValidation(e) {
	if (e.isValid) {
//		if (isEmail(e.value) == false) {
//			e.errorText = "必须输入邮件地址";
//			e.isValid = false;
//		}
		if(e.value == ''){
			e.errorText = "请输入用户名";
			e.isValid = false;
		}
	}
}
function onPwdValidation(e) {
	if (e.isValid) {
		if (e.value.length < 5) {
			e.errorText = "密码不能少于5个字符";
			e.isValid = false;
		}
	}
}